/*
*********************************
	  SF2D Engine
*********************************

	By Julian Williams
	June 11, 2010
**********************************

	Description:

		Physicaly simulated world
	that is backed by Box2d
***********************************
*/
#include "helper.h"
#include "physics_world.h"

 PhysicsWorld physicsManager;



PhysicsWorld::PhysicsWorld()
{
	
	velocityIterations = 10;
	positionIterations = 10;

	world = new b2World(b2Vec2(0, 0), true);
	physicsListener = new PhysicsListener();

	world->SetContactListener( physicsListener );
}


PhysicsWorld::~PhysicsWorld(void)
{
	safeDelete(physicsListener);
	safeDelete(world);

}



void PhysicsWorld::Update_Logic(float dt)
{
	//step the Box2D physics world, with a constant time step
	physicsManager.world->Step( dt, velocityIterations, positionIterations);
	physicsManager.world->ClearForces();
}//EoF
